<?php

/**
 * RoomBooking Component Controller
 *  
 * @version    1.0
 * @package    Joomla
 * @subpackage RoomBooking
 * @copyright (C) 2011 Giovanni Marzulli
 * @license	   GNU/GPL
 */
// No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

class RoomBookingController extends JController {

    function __construct() {
        parent::__construct();
    }

    /**
     * Method to display the view
     *
     * @access    public
     */
    function display() {

        if (JRequest::getVar('view') == 'archive') {
            $modelBookings = & $this->getModel('bookings');
            $view = $this->getView('archive', 'html');
            $view->setModel($modelBookings);
        }
        if (JRequest::getVar('view') == 'csv') {
            $modelBookings = & $this->getModel('bookings');
            $view = $this->getView('csv', 'html');
            $view->setModel($modelBookings);
            $this->setRedirect( 'index.php?option=com_roombooking&view=statistics', 'export csv successfully!' ,'message');
        }
        parent::display();
    }

}

